﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// Provides methods that assist in the saving and resetting of a control's state.
	/// </summary>
	internal static class SavedStateUtils
	{
		/// <summary>
		/// Gets a copy of a state value (to avoid modifying mutable objects).
		/// </summary>
		/// <param name="value"></param>
		/// <returns></returns>
		internal static object GetValueCopy(object value)
		{
			if (value is ICloneable)
				return ((ICloneable)value).Clone();
			return value;
		}
	}
}
